﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace FourKill.Engine
{
    public class ThreeDimensionalObject : BaseGameObject
    {
        private bool _isOffset = false;
        private readonly List<List<ICoordinates3D>> _polygons;
        private RectangleF _boundries = RectangleF.Empty;
        public Image Texture { get; set; }
        public ThreeDimensionalObject(List<List<ICoordinates3D>> basePolygons)
        {
            _polygons = basePolygons;
            this.Color = Color.White;

        }

        public override void Tick()
        {
        }

        public List<List<ICoordinates3D>> Polygons
        {
            get 
            {
                int minX = 0, minY = 0, maxX = 0, maxY = 0;
                if (!_isOffset)
                {
                    foreach (var l in _polygons) 
                    {
                        foreach (var p in l)
                        {
                            p.X += this.X;
                            p.Y += this.Y;
                            p.Z += this.Z;
                        }
                    }
                    _isOffset = true;
                }
                return _polygons;
            }
        }

        public override IPaintable Painter
        {
            get
            {
                return (IPaintable)ThreeDimensional.Instance;
            }
        }
    }
}
